package com.cms.clash.error;


import com.cms.clash.util.TemplateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
/**
 * GlobalExceptionHandler
 * @author cms
 * @version 1.0.0
 * @date 2024/7/28
*/

@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    /**
     * 处理所有的异常和Throwable类
     * @return
     */
    @ExceptionHandler({Exception.class, Throwable.class})
    public String testExceptionHandler1(Exception ex, Model model) {
        log.error(ex.getMessage());
        TemplateUtil.setSiteInfoMap(model);
        return TemplateUtil.TEMPLATE_PAGE500;
    }
}
